﻿//-----------------------------------------------------------------------
// <copyright file="TaskResult.cs" company="Numbrella foundation">
// Copyright (c) Numbrella foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Numbrella.Core
{
	using System;
	using Numbrella.Interaction;
	
	/// <summary>
	/// Represents implementation of <see cref="ITaskResult"/> that holds result contents.
	/// </summary>
	/// <typeparam name="TContents">Type that represents result contents.</typeparam>
	[Serializable]
	public class TaskResult<TContents> : ITaskResult
	{
		#region Fields

		/// <summary>
		/// Contains unique identifier of the <see cref="ITask"/> associated with this result.
		/// </summary>
		private readonly int taskId;

		/// <summary>
		/// Contains task solve result.
		/// </summary>
		private readonly TContents contents;

		#endregion
		
		/// <summary>
		/// Initializes a new instance of the <see cref="TaskResult{TContents}"/> class.
		/// </summary>
		/// <param name="contents">Result contents.</param>
		/// <param name="taskId">Unique identifier of the task which is owner of result.</param>
		internal TaskResult(TContents contents, int taskId)
		{
			this.contents = contents;
			this.taskId = taskId;
		}

		#region Properties

		/// <summary>
		/// Gets task solve result.
		/// </summary>
		public TContents Contents
		{
			get { return this.contents; }
		}

		/// <summary>
		/// Gets unique identifier of the <see cref="ITask"/> associated with this result.
		/// </summary>
		public int TaskId
		{
			get { return this.taskId; }
		}

		#endregion
	}
}
